package com.k.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.k.demo.entity.Food;
import com.k.demo.entity.Notice;

@Mapper
public interface NoticeMapper {

	@Select("select * from notice where is_delete=1")
	List<Notice> selectAll();
	
	@Select("select * from notice where notice_status=1 and is_delete=1")
	Notice selectShow();
	
	//公告增删改
	//公告增加
	int addNotice(Notice notice);
	
	//公告真删除
	@Update("update notice set is_delete=0 where notice_id=#{notice_id}")
	int trueDeleteNotice(Integer notice_id);
	
	//公告假删除
	@Delete("delete from notice where notice_id=#{notice_id}")
	int falseDeleteNotice(Integer notice_id);
	
	
	//公告撤销
	@Update("update notice set foperate_flag=0 where notice_id=#{notice_id}")
	int revokeNotice(Integer notice_id);
	
	//批量删除
	boolean deleteByGroup(List<Integer> list);

	
	//公告修改
	int updateNotice(Notice notice);
	
	//根据公告内容的查找
	List<Notice> selectByName(String notice_content);
	
	//根据时间间隔查找
	List<Notice> selectByTime(@Param("time1") String time1, @Param("time2") String time2);
	
	//修改公告状态为在首页播放
	@Update("update notice set notice_status=1 where notice_id=#{notice_id}")
	int modifyState(int notice_id);
	
	//修改所有的状态
	@Update("update notice set notice_status=0 where notice_status=1")
	int modifAllState();
	
	
}
